#! /bin/bash 

for i in affectation add sub mul div if ifelse while for def fibo tri
do
    ../rubic $i.ll < code/test_$i.rb
    llvm-as $i.ll
    llc $i.bc
    gcc $i.s ../bin/fonctions.o -o $i
    res=$(./$i)
    expected=$(cat resultat/expected_$i)
    printf %-18s $i
    if [[ $res == $expected && $res != "" ]]
    then
	echo -ne "\E[1;32m SUCCESS\n"
    else
	echo -e "\E[1;31m FAILURE\n"
    fi
    tput sgr0	
done
echo -ne "\n"
rm *.bc *.s
